<?php


abstract class BaseFunrPersonarelPeer {

	
	const DATABASE_NAME = 'propel';

	
	const TABLE_NAME = 'funr_personarel';

	
	const CLASS_DEFAULT = 'lib.model.FunrPersonarel';

	
	const NUM_COLUMNS = 16;

	
	const NUM_LAZY_LOAD_COLUMNS = 0;


	
	const FUNR_PERSONAREL_ID = 'funr_personarel.FUNR_PERSONAREL_ID';

	
	const FUNPER_NOMBRE = 'funr_personarel.FUNPER_NOMBRE';

	
	const FUNPER_APELLIDO = 'funr_personarel.FUNPER_APELLIDO';

	
	const FUNPER_EDAD = 'funr_personarel.FUNPER_EDAD';

	
	const FUNPER_SEXO = 'funr_personarel.FUNPER_SEXO';

	
	const FUNPER_DIRECCION = 'funr_personarel.FUNPER_DIRECCION';

	
	const FUNPER_TELEFONO = 'funr_personarel.FUNPER_TELEFONO';

	
	const FUNPER_ESCOLARIDAD = 'funr_personarel.FUNPER_ESCOLARIDAD';

	
	const FUNPER_OCUPACION = 'funr_personarel.FUNPER_OCUPACION';

	
	const FUNPER_ECIVIL = 'funr_personarel.FUNPER_ECIVIL';

	
	const FUNPER_INGRESO = 'funr_personarel.FUNPER_INGRESO';

	
	const FUNPER_BONOSOLI = 'funr_personarel.FUNPER_BONOSOLI';

	
	const FUNPER_DENUNCIANTE = 'funr_personarel.FUNPER_DENUNCIANTE';

	
	const FUNPER_ESTADO = 'funr_personarel.FUNPER_ESTADO';

	
	const FUNT_CASO_ID = 'funr_personarel.FUNT_CASO_ID';

	
	const FUNR_TIPORELACION_ID = 'funr_personarel.FUNR_TIPORELACION_ID';

	
	private static $phpNameMap = null;


	
	private static $fieldNames = array (
		BasePeer::TYPE_PHPNAME => array ('FunrPersonarelId', 'FunperNombre', 'FunperApellido', 'FunperEdad', 'FunperSexo', 'FunperDireccion', 'FunperTelefono', 'FunperEscolaridad', 'FunperOcupacion', 'FunperEcivil', 'FunperIngreso', 'FunperBonosoli', 'FunperDenunciante', 'FunperEstado', 'FuntCasoId', 'FunrTiporelacionId', ),
		BasePeer::TYPE_COLNAME => array (FunrPersonarelPeer::FUNR_PERSONAREL_ID, FunrPersonarelPeer::FUNPER_NOMBRE, FunrPersonarelPeer::FUNPER_APELLIDO, FunrPersonarelPeer::FUNPER_EDAD, FunrPersonarelPeer::FUNPER_SEXO, FunrPersonarelPeer::FUNPER_DIRECCION, FunrPersonarelPeer::FUNPER_TELEFONO, FunrPersonarelPeer::FUNPER_ESCOLARIDAD, FunrPersonarelPeer::FUNPER_OCUPACION, FunrPersonarelPeer::FUNPER_ECIVIL, FunrPersonarelPeer::FUNPER_INGRESO, FunrPersonarelPeer::FUNPER_BONOSOLI, FunrPersonarelPeer::FUNPER_DENUNCIANTE, FunrPersonarelPeer::FUNPER_ESTADO, FunrPersonarelPeer::FUNT_CASO_ID, FunrPersonarelPeer::FUNR_TIPORELACION_ID, ),
		BasePeer::TYPE_FIELDNAME => array ('funr_personarel_id', 'funper_nombre', 'funper_apellido', 'funper_edad', 'funper_sexo', 'funper_direccion', 'funper_telefono', 'funper_escolaridad', 'funper_ocupacion', 'funper_ecivil', 'funper_ingreso', 'funper_bonosoli', 'funper_denunciante', 'funper_estado', 'funt_caso_id', 'funr_tiporelacion_id', ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
	);

	
	private static $fieldKeys = array (
		BasePeer::TYPE_PHPNAME => array ('FunrPersonarelId' => 0, 'FunperNombre' => 1, 'FunperApellido' => 2, 'FunperEdad' => 3, 'FunperSexo' => 4, 'FunperDireccion' => 5, 'FunperTelefono' => 6, 'FunperEscolaridad' => 7, 'FunperOcupacion' => 8, 'FunperEcivil' => 9, 'FunperIngreso' => 10, 'FunperBonosoli' => 11, 'FunperDenunciante' => 12, 'FunperEstado' => 13, 'FuntCasoId' => 14, 'FunrTiporelacionId' => 15, ),
		BasePeer::TYPE_COLNAME => array (FunrPersonarelPeer::FUNR_PERSONAREL_ID => 0, FunrPersonarelPeer::FUNPER_NOMBRE => 1, FunrPersonarelPeer::FUNPER_APELLIDO => 2, FunrPersonarelPeer::FUNPER_EDAD => 3, FunrPersonarelPeer::FUNPER_SEXO => 4, FunrPersonarelPeer::FUNPER_DIRECCION => 5, FunrPersonarelPeer::FUNPER_TELEFONO => 6, FunrPersonarelPeer::FUNPER_ESCOLARIDAD => 7, FunrPersonarelPeer::FUNPER_OCUPACION => 8, FunrPersonarelPeer::FUNPER_ECIVIL => 9, FunrPersonarelPeer::FUNPER_INGRESO => 10, FunrPersonarelPeer::FUNPER_BONOSOLI => 11, FunrPersonarelPeer::FUNPER_DENUNCIANTE => 12, FunrPersonarelPeer::FUNPER_ESTADO => 13, FunrPersonarelPeer::FUNT_CASO_ID => 14, FunrPersonarelPeer::FUNR_TIPORELACION_ID => 15, ),
		BasePeer::TYPE_FIELDNAME => array ('funr_personarel_id' => 0, 'funper_nombre' => 1, 'funper_apellido' => 2, 'funper_edad' => 3, 'funper_sexo' => 4, 'funper_direccion' => 5, 'funper_telefono' => 6, 'funper_escolaridad' => 7, 'funper_ocupacion' => 8, 'funper_ecivil' => 9, 'funper_ingreso' => 10, 'funper_bonosoli' => 11, 'funper_denunciante' => 12, 'funper_estado' => 13, 'funt_caso_id' => 14, 'funr_tiporelacion_id' => 15, ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
	);

	
	public static function getMapBuilder()
	{
		include_once 'lib/model/map/FunrPersonarelMapBuilder.php';
		return BasePeer::getMapBuilder('lib.model.map.FunrPersonarelMapBuilder');
	}
	
	public static function getPhpNameMap()
	{
		if (self::$phpNameMap === null) {
			$map = FunrPersonarelPeer::getTableMap();
			$columns = $map->getColumns();
			$nameMap = array();
			foreach ($columns as $column) {
				$nameMap[$column->getPhpName()] = $column->getColumnName();
			}
			self::$phpNameMap = $nameMap;
		}
		return self::$phpNameMap;
	}
	
	static public function translateFieldName($name, $fromType, $toType)
	{
		$toNames = self::getFieldNames($toType);
		$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
		if ($key === null) {
			throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
		}
		return $toNames[$key];
	}

	

	static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
	{
		if (!array_key_exists($type, self::$fieldNames)) {
			throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
		}
		return self::$fieldNames[$type];
	}

	
	public static function alias($alias, $column)
	{
		return str_replace(FunrPersonarelPeer::TABLE_NAME.'.', $alias.'.', $column);
	}

	
	public static function addSelectColumns(Criteria $criteria)
	{

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNR_PERSONAREL_ID);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_NOMBRE);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_APELLIDO);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_EDAD);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_SEXO);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_DIRECCION);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_TELEFONO);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_ESCOLARIDAD);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_OCUPACION);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_ECIVIL);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_INGRESO);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_BONOSOLI);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_DENUNCIANTE);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNPER_ESTADO);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNT_CASO_ID);

		$criteria->addSelectColumn(FunrPersonarelPeer::FUNR_TIPORELACION_ID);

	}

	const COUNT = 'COUNT(funr_personarel.FUNR_PERSONAREL_ID)';
	const COUNT_DISTINCT = 'COUNT(DISTINCT funr_personarel.FUNR_PERSONAREL_ID)';

	
	public static function doCount(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}
	
	public static function doSelectOne(Criteria $criteria, $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = FunrPersonarelPeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}
	
	public static function doSelect(Criteria $criteria, $con = null)
	{
		return FunrPersonarelPeer::populateObjects(FunrPersonarelPeer::doSelectRS($criteria, $con));
	}
	
	public static function doSelectRS(Criteria $criteria, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if (!$criteria->getSelectColumns()) {
			$criteria = clone $criteria;
			FunrPersonarelPeer::addSelectColumns($criteria);
		}

				$criteria->setDbName(self::DATABASE_NAME);

						return BasePeer::doSelect($criteria, $con);
	}
	
	public static function populateObjects(ResultSet $rs)
	{
		$results = array();
	
				$cls = FunrPersonarelPeer::getOMClass();
		$cls = Propel::import($cls);
				while($rs->next()) {
		
			$obj = new $cls();
			$obj->hydrate($rs);
			$results[] = $obj;
			
		}
		return $results;
	}

	
	public static function doCountJoinFuntCaso(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinFunrTiporelacion(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinFuntCaso(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		FunrPersonarelPeer::addSelectColumns($c);
		$startcol = (FunrPersonarelPeer::NUM_COLUMNS - FunrPersonarelPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		FuntCasoPeer::addSelectColumns($c);

		$c->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = FunrPersonarelPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = FuntCasoPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getFuntCaso(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addFunrPersonarel($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initFunrPersonarels();
				$obj2->addFunrPersonarel($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinFunrTiporelacion(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		FunrPersonarelPeer::addSelectColumns($c);
		$startcol = (FunrPersonarelPeer::NUM_COLUMNS - FunrPersonarelPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		FunrTiporelacionPeer::addSelectColumns($c);

		$c->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = FunrPersonarelPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = FunrTiporelacionPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getFunrTiporelacion(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addFunrPersonarel($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initFunrPersonarels();
				$obj2->addFunrPersonarel($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
	{
		$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);

		$criteria->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinAll(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		FunrPersonarelPeer::addSelectColumns($c);
		$startcol2 = (FunrPersonarelPeer::NUM_COLUMNS - FunrPersonarelPeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		FuntCasoPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + FuntCasoPeer::NUM_COLUMNS;

		FunrTiporelacionPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + FunrTiporelacionPeer::NUM_COLUMNS;

		$c->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);

		$c->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);

		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = FunrPersonarelPeer::getOMClass();


			$cls = Propel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);


					
			$omClass = FuntCasoPeer::getOMClass();


			$cls = Propel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getFuntCaso(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addFunrPersonarel($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj2->initFunrPersonarels();
				$obj2->addFunrPersonarel($obj1);
			}


					
			$omClass = FunrTiporelacionPeer::getOMClass();


			$cls = Propel::import($omClass);
			$obj3 = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getFunrTiporelacion(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addFunrPersonarel($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj3->initFunrPersonarels();
				$obj3->addFunrPersonarel($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doCountJoinAllExceptFuntCaso(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinAllExceptFunrTiporelacion(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(FunrPersonarelPeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);

		$rs = FunrPersonarelPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinAllExceptFuntCaso(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		FunrPersonarelPeer::addSelectColumns($c);
		$startcol2 = (FunrPersonarelPeer::NUM_COLUMNS - FunrPersonarelPeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		FunrTiporelacionPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + FunrTiporelacionPeer::NUM_COLUMNS;

		$c->addJoin(FunrPersonarelPeer::FUNR_TIPORELACION_ID, FunrTiporelacionPeer::FUNR_TIPORELACION_ID);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = FunrPersonarelPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = FunrTiporelacionPeer::getOMClass();


			$cls = Propel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getFunrTiporelacion(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addFunrPersonarel($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initFunrPersonarels();
				$obj2->addFunrPersonarel($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinAllExceptFunrTiporelacion(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		FunrPersonarelPeer::addSelectColumns($c);
		$startcol2 = (FunrPersonarelPeer::NUM_COLUMNS - FunrPersonarelPeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		FuntCasoPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + FuntCasoPeer::NUM_COLUMNS;

		$c->addJoin(FunrPersonarelPeer::FUNT_CASO_ID, FuntCasoPeer::FUNT_CASO_ID);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = FunrPersonarelPeer::getOMClass();

			$cls = Propel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = FuntCasoPeer::getOMClass();


			$cls = Propel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getFuntCaso(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addFunrPersonarel($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initFunrPersonarels();
				$obj2->addFunrPersonarel($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}

	
	public static function getTableMap()
	{
		return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
	}

	
	public static function getOMClass()
	{
		return FunrPersonarelPeer::CLASS_DEFAULT;
	}

	
	public static function doInsert($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} else {
			$criteria = $values->buildCriteria(); 		}

		$criteria->remove(FunrPersonarelPeer::FUNR_PERSONAREL_ID); 

				$criteria->setDbName(self::DATABASE_NAME);

		try {
									$con->begin();
			$pk = BasePeer::doInsert($criteria, $con);
			$con->commit();
		} catch(PropelException $e) {
			$con->rollback();
			throw $e;
		}

		return $pk;
	}

	
	public static function doUpdate($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$selectCriteria = new Criteria(self::DATABASE_NAME);

		if ($values instanceof Criteria) {
			$criteria = clone $values; 
			$comparison = $criteria->getComparison(FunrPersonarelPeer::FUNR_PERSONAREL_ID);
			$selectCriteria->add(FunrPersonarelPeer::FUNR_PERSONAREL_ID, $criteria->remove(FunrPersonarelPeer::FUNR_PERSONAREL_ID), $comparison);

		} else { 			$criteria = $values->buildCriteria(); 			$selectCriteria = $values->buildPkeyCriteria(); 		}

				$criteria->setDbName(self::DATABASE_NAME);

		return BasePeer::doUpdate($selectCriteria, $criteria, $con);
	}

	
	public static function doDeleteAll($con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}
		$affectedRows = 0; 		try {
									$con->begin();
			$affectedRows += BasePeer::doDeleteAll(FunrPersonarelPeer::TABLE_NAME, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	 public static function doDelete($values, $con = null)
	 {
		if ($con === null) {
			$con = Propel::getConnection(FunrPersonarelPeer::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} elseif ($values instanceof FunrPersonarel) {

			$criteria = $values->buildPkeyCriteria();
		} else {
						$criteria = new Criteria(self::DATABASE_NAME);
			$criteria->add(FunrPersonarelPeer::FUNR_PERSONAREL_ID, (array) $values, Criteria::IN);
		}

				$criteria->setDbName(self::DATABASE_NAME);

		$affectedRows = 0; 
		try {
									$con->begin();
			
			$affectedRows += BasePeer::doDelete($criteria, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public static function doValidate(FunrPersonarel $obj, $cols = null)
	{
		$columns = array();

		if ($cols) {
			$dbMap = Propel::getDatabaseMap(FunrPersonarelPeer::DATABASE_NAME);
			$tableMap = $dbMap->getTable(FunrPersonarelPeer::TABLE_NAME);

			if (! is_array($cols)) {
				$cols = array($cols);
			}

			foreach($cols as $colName) {
				if ($tableMap->containsColumn($colName)) {
					$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
					$columns[$colName] = $obj->$get();
				}
			}
		} else {

		}

		$res =  BasePeer::doValidate(FunrPersonarelPeer::DATABASE_NAME, FunrPersonarelPeer::TABLE_NAME, $columns);
    if ($res !== true) {
        $request = sfContext::getInstance()->getRequest();
        foreach ($res as $failed) {
            $col = FunrPersonarelPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
            $request->setError($col, $failed->getMessage());
        }
    }

    return $res;
	}

	
	public static function retrieveByPK($pk, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$criteria = new Criteria(FunrPersonarelPeer::DATABASE_NAME);

		$criteria->add(FunrPersonarelPeer::FUNR_PERSONAREL_ID, $pk);


		$v = FunrPersonarelPeer::doSelect($criteria, $con);

		return !empty($v) > 0 ? $v[0] : null;
	}

	
	public static function retrieveByPKs($pks, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$objs = null;
		if (empty($pks)) {
			$objs = array();
		} else {
			$criteria = new Criteria();
			$criteria->add(FunrPersonarelPeer::FUNR_PERSONAREL_ID, $pks, Criteria::IN);
			$objs = FunrPersonarelPeer::doSelect($criteria, $con);
		}
		return $objs;
	}

} 
if (Propel::isInit()) {
			try {
		BaseFunrPersonarelPeer::getMapBuilder();
	} catch (Exception $e) {
		Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
	}
} else {
			require_once 'lib/model/map/FunrPersonarelMapBuilder.php';
	Propel::registerMapBuilder('lib.model.map.FunrPersonarelMapBuilder');
}
